<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">

                <div class="ibox-content">
                    <form method="post" class="form-horizontal" onsubmit="return false">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*用户</label>
                            <div class="col-sm-10">
                                <input class="form-control" type="text" name="name" id="name" placeholder="用户名"
                                       value="<{$user.truename}>" readonly/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*手机号码或ID</label>
                            <div class="col-sm-10">
                                <input class="form-control" type="tel" name="phone" id="phone" placeholder="请输入手机号码"
                                       value="<{$user.mobile}>" readonly/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*沟通描述</label>
                            <div class="col-sm-10">
                                <textarea id="content" name="content" cols="70" rows="11" onkeyup="save_now()"
                                          placeholder="请描述用户来电咨询内容"><{$user.content}></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">*选择回电状态</label>
                            <div class="col-sm-10">
                                <select id="back_status" class="selectBox" onchange="show_hide(this)">
                                    <option value="1">无需回电</option>
                                    <option value="2">需回电</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*选择接通状态</label>
                            <div class="col-sm-10">
                                <select id="commit_status" class="selectBox">
                                    <option value="1">未接通</option>
                                    <option value="4">已告知</option>
                                    <option value="2">已沟通</option>
                                    <option value="3">关机</option>
                                    <option value="5">停机</option>
                                    <option value="7">空号</option>
                                    <option value="8">挂断</option>
                                    <option value="6">无借款需求</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*选择反馈类别</label>
                            <div class="col-sm-10">
                                <select id="category_feedback" class="selectBox">
                                    <option value="1">普通</option>
                                    <option value="2">投诉</option>
                                    <option value="3">所属项目</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group" id="time_pick" style="display: none">
                            <label class="col-sm-2 control-label">要求回复时间</label>
                            <div class="col-sm-10">
                                <input class="laydate-icon form-control" id="reply_time" name="reply_time" type="text"
                                       placeholder="没有要求可以为空" readonly=""
                                       onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm'})">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary"
                                        style="background-color: #31b0d5;color: #31b0d5; border-color: #31b0d5"
                                        type="button" id="click_sub" onclick="back_add()">提交
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/content.js?v=1.0.0"></script>
<script src="/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/js/layer/layer.js"></script>
<script src="/Public/js/layui/layui.js"></script>
<script src="/Public/js/layui/lay/modules/laydate.js"></script>
<script>

    document.onkeydown = function (event) {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode == 13) { // enter 键
            $('#click_sub').click();
            //要做的事情
        }
    };

    function show_hide(obj) {
        var val=obj.value;
        if(val=='1'){
            $('#time_pick').hide();
        }else {
            $('#time_pick').show();
        }
    }
    var content_cache=   sessionStorage.getItem('reord_cache');
    $("#content").val(content_cache);

    //编辑保存
    function save_now() {
        var phone = "<{$user.mobile}>";
        var vid = "<{$user.vid}>";
        var callid = "<{$callid}>";
        var content = $("#content").val();
        sessionStorage.setItem('reord_cache',content);




    }
    //回复反馈
    function back_add() {
        //加载loading层
        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var phone = "<{$user.mobile}>";
        var vid = "<{$user.vid}>";
        var callid = "<{$callid}>";
        var content = $("#content").val();
        var back_type = $("#back_status").val();
        var commit_type = $("#commit_status").find("option:selected").text();
        var commit_status = $("#commit_status").val();
        var category_feedback = $("#category_feedback").val();
        var reply_time = $("#reply_time").val();
        var url = "<{$SERVER_NAME}>/User/add_call";
        layer.alert('确定提交',{title: '提示框', icon: 3},function (index) {
            $.post(url, {
                callid: callid,
                content: content,
                phone: phone,
                commit_type: commit_type,
                commit_status: commit_status,
                back_type: back_type,
                reply_time: reply_time,
                vid: vid,
                category: category_feedback
            }, function (data) {
                if (data.code == "1001") {
                    sessionStorage.setItem('reord_cache',"");
                    var test = layer.alert(data.result, {title: '提示框', icon: 1}, function (index) {
                            layer.close(index);
                            window.history.go(-1);
//                         window.location.href = "<{$SERVER_NAME}>/UserCenter/call_record.html?vid=" + vid;
                        }
                    );
                }
                else {
                    layer.alert(data.result, {title: '提示框', icon: 0});
                }
            });
            layer.close(index);
        });

        layer.close(index);
    }

</script>
</body>
</html>
